package sort;

/**
 * SelectionSort
 *
 * @author admin
 * @version 2023/11/02 10:17
 **/
public class SelectionSort implements SortStrategy{
    @Override
    public void sort(int[] a) {
        for(int i=0;i<a.length;i++)
        {
            int min=a[i];
            int min_index=i;
            for(int j=i;j<a.length;j++)
            {
                if(a[j]<min){
                    min=a[j];
                    min_index=j;
                }
            }
            swap(i,min_index,a);
        }
    }
}
